<!doctype html>

<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>timezonelist_test.js (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>

<div class="clear"></div>

<h2><a href="local_closure_goog_locale_timezonelist_test.js.html">timezonelist_test.js</a></h2>

<pre class="prettyprint lang-js">
<a name="line1"></a>// Copyright 2007 The Closure Library Authors. All Rights Reserved.
<a name="line2"></a>//
<a name="line3"></a>// Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
<a name="line4"></a>// you may not use this file except in compliance with the License.
<a name="line5"></a>// You may obtain a copy of the License at
<a name="line6"></a>//
<a name="line7"></a>//      http://www.apache.org/licenses/LICENSE-2.0
<a name="line8"></a>//
<a name="line9"></a>// Unless required by applicable law or agreed to in writing, software
<a name="line10"></a>// distributed under the License is distributed on an &quot;AS-IS&quot; BASIS,
<a name="line11"></a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a name="line12"></a>// See the License for the specific language governing permissions and
<a name="line13"></a>// limitations under the License.
<a name="line14"></a>
<a name="line15"></a>goog.provide(&#39;goog.locale.TimeZoneListTest&#39;);
<a name="line16"></a>goog.setTestOnly(&#39;goog.locale.TimeZoneListTest&#39;);
<a name="line17"></a>
<a name="line18"></a>goog.require(&#39;goog.locale&#39;);
<a name="line19"></a>/** @suppress {extraRequire} */
<a name="line20"></a>goog.require(&#39;goog.locale.TimeZoneList&#39;);
<a name="line21"></a>goog.require(&#39;goog.testing.jsunit&#39;);
<a name="line22"></a>
<a name="line23"></a>function setUpPage() {
<a name="line24"></a>  // Test data files are in in http://go/js_locale_data
<a name="line25"></a>
<a name="line26"></a>  // Test data from TimeZoneSelectedIds__FR.js
<a name="line27"></a>  var TimeZoneSelectedIds__FR = [
<a name="line28"></a>    &#39;Etc/GMT+12&#39;,
<a name="line29"></a>    &#39;Pacific/Midway&#39;,
<a name="line30"></a>    &#39;America/Adak&#39;,
<a name="line31"></a>    &#39;Pacific/Honolulu&#39;
<a name="line32"></a>  ];
<a name="line33"></a>  goog.locale.registerTimeZoneSelectedIds(TimeZoneSelectedIds__FR, &#39;FR&#39;);
<a name="line34"></a>
<a name="line35"></a>  // Test data from TimeZoneSelectedShortNames__de_DE.js
<a name="line36"></a>  var TimeZoneSelectedShortNames__de_DE = {
<a name="line37"></a>    &#39;Etc/GMT+12&#39;: &#39;GMT-12:00&#39;,
<a name="line38"></a>    &#39;Etc/GMT+11&#39;: &#39;GMT-11:00&#39;,
<a name="line39"></a>    &#39;Pacific/Pago_Pago&#39;: &#39;Amerikanisch-Samoa&#39;,
<a name="line40"></a>    &#39;Pacific/Midway&#39;: &#39;Midway (Amerikanisch-Ozeanien)&#39;,
<a name="line41"></a>    &#39;Pacific/Honolulu&#39;: &#39;Honolulu (Vereinigte Staaten)&#39;,
<a name="line42"></a>    &#39;Etc/GMT+10&#39;: &#39;GMT-10:00&#39;,
<a name="line43"></a>    &#39;America/Adak&#39;: &#39;Adak (Vereinigte Staaten)&#39;
<a name="line44"></a>  };
<a name="line45"></a>  goog.locale.registerTimeZoneSelectedShortNames(
<a name="line46"></a>      TimeZoneSelectedShortNames__de_DE, &#39;de_DE&#39;);
<a name="line47"></a>
<a name="line48"></a>  // Test data from TimeZoneSelectedLongNames__de_DE.js
<a name="line49"></a>  var TimeZoneSelectedLongNames__de_DE = {
<a name="line50"></a>    &#39;Etc/GMT+12&#39;: &#39;GMT-12:00&#39;,
<a name="line51"></a>    &#39;Etc/GMT+11&#39;: &#39;GMT-11:00&#39;,
<a name="line52"></a>    &#39;Pacific/Pago_Pago&#39;: &#39;GMT-11:00 Amerikanisch-Samoa&#39;,
<a name="line53"></a>    &#39;Pacific/Midway&#39;: &#39;GMT-11:00 Midway (Amerikanisch-Ozeanien)&#39;,
<a name="line54"></a>    &#39;Pacific/Honolulu&#39;: &#39;GMT-10:00 Honolulu (Vereinigte Staaten)&#39;,
<a name="line55"></a>    &#39;Etc/GMT+10&#39;: &#39;GMT-10:00&#39;,
<a name="line56"></a>    &#39;America/Adak&#39;: &#39;GMT-10:00 Adak (Vereinigte Staaten)&#39;
<a name="line57"></a>  };
<a name="line58"></a>  goog.locale.registerTimeZoneSelectedLongNames(
<a name="line59"></a>      TimeZoneSelectedLongNames__de_DE, &#39;de_DE&#39;);
<a name="line60"></a>
<a name="line61"></a>  // Test data from TimeZoneSelectedIds__en.js
<a name="line62"></a>  var TimeZoneSelectedIds__en = [
<a name="line63"></a>    &#39;Etc/GMT+12&#39;,
<a name="line64"></a>    &#39;Pacific/Midway&#39;,
<a name="line65"></a>    &#39;America/Adak&#39;,
<a name="line66"></a>    &#39;Pacific/Honolulu&#39;
<a name="line67"></a>  ];
<a name="line68"></a>  goog.locale.registerTimeZoneSelectedIds(TimeZoneSelectedIds__en, &#39;en&#39;);
<a name="line69"></a>
<a name="line70"></a>  // Test data from TimeZoneSelectedIds__DE.js
<a name="line71"></a>  var TimeZoneSelectedIds__DE = [
<a name="line72"></a>    &#39;Etc/GMT+12&#39;,
<a name="line73"></a>    &#39;Pacific/Midway&#39;,
<a name="line74"></a>    &#39;America/Adak&#39;,
<a name="line75"></a>    &#39;Pacific/Honolulu&#39;
<a name="line76"></a>  ];
<a name="line77"></a>  goog.locale.registerTimeZoneSelectedIds(TimeZoneSelectedIds__DE, &#39;DE&#39;);
<a name="line78"></a>
<a name="line79"></a>  // Test data from TimeZoneAllLongNames__de_DE.js
<a name="line80"></a>  var TimeZoneAllLongNames__de_DE = [
<a name="line81"></a>    {id: &#39;Etc/GMT+12&#39;, name: &#39;GMT-12:00&#39;},
<a name="line82"></a>    {id: &#39;Pacific/Apia&#39;, name: &#39;GMT-11:00 Samoa&#39;},
<a name="line83"></a>    {id: &#39;Pacific/Midway&#39;, name: &#39;GMT-11:00 Midway (Amerikanisch-Ozeanien)&#39;},
<a name="line84"></a>    {id: &#39;Pacific/Niue&#39;, name: &#39;GMT-11:00 Niue&#39;},
<a name="line85"></a>    {id: &#39;Pacific/Pago_Pago&#39;, name: &#39;GMT-11:00 Amerikanisch-Samoa&#39;},
<a name="line86"></a>    {id: &#39;Etc/GMT+11&#39;, name: &#39;GMT-11:00&#39;},
<a name="line87"></a>    {id: &#39;America/Adak&#39;, name: &#39;GMT-10:00 Adak (Vereinigte Staaten)&#39;},
<a name="line88"></a>    {id: &#39;Pacific/Fakaofo&#39;, name: &#39;GMT-10:00 Tokelau&#39;}
<a name="line89"></a>  ];
<a name="line90"></a>  goog.locale.registerTimeZoneAllLongNames(TimeZoneAllLongNames__de_DE,
<a name="line91"></a>      &#39;de_DE&#39;);
<a name="line92"></a>
<a name="line93"></a>  goog.locale.setLocale(&#39;de_DE&#39;);
<a name="line94"></a>}
<a name="line95"></a>
<a name="line96"></a>/* Uncomment to display complete listing in the unit tested invocations.
<a name="line97"></a>
<a name="line98"></a>document.write(&#39;Shortnames in German for France:&lt;br&gt;&#39;);
<a name="line99"></a>
<a name="line100"></a>var idlist = goog.locale.getTimeZoneSelectedShortNames(&#39;FR&#39;);
<a name="line101"></a>
<a name="line102"></a>for (var i = 0; i &lt; idlist.length; i++) {
<a name="line103"></a>  document.write(i + &#39;) &#39; + idlist[i].id + &#39; = &#39; + idlist[i].name + &#39;&lt;br&gt;&#39;);
<a name="line104"></a>}
<a name="line105"></a>
<a name="line106"></a>document.write(&#39;&lt;hr&gt;&#39;);
<a name="line107"></a>
<a name="line108"></a>document.write(&#39;long names in German for all en speakers:&lt;br&gt;&#39;);
<a name="line109"></a>var idlist = goog.locale.getTimeZoneSelectedLongNames(&#39;en&#39;);
<a name="line110"></a>
<a name="line111"></a>for (var i = 0; i &lt; idlist.length; i++) {
<a name="line112"></a>  document.write(i + &#39;) &#39; + idlist[i].id + &#39; = &#39; + idlist[i].name + &#39;&lt;br&gt;&#39;);
<a name="line113"></a>}
<a name="line114"></a>
<a name="line115"></a>document.write(&#39;&lt;hr&gt;&#39;);
<a name="line116"></a>
<a name="line117"></a>document.write(&#39;Longnames in German for germans:&lt;br&gt;&#39;);
<a name="line118"></a>var idlist = goog.locale.getTimeZoneSelectedLongNames();
<a name="line119"></a>
<a name="line120"></a>for (var i = 0; i &lt; idlist.length; i++) {
<a name="line121"></a>  document.write(i + &#39;) &#39; + idlist[i].id + &#39; = &#39; + idlist[i].name + &#39;&lt;br&gt;&#39;);
<a name="line122"></a>}
<a name="line123"></a>
<a name="line124"></a>document.write(&#39;&lt;hr&gt;&#39;);
<a name="line125"></a>
<a name="line126"></a>document.write(&#39;All longnames in German:&lt;br&gt;&#39;);
<a name="line127"></a>var idlist = goog.locale.getTimeZoneAllLongNames();
<a name="line128"></a>
<a name="line129"></a>for (var i = 0; i &lt; idlist.length; i++) {
<a name="line130"></a>  var pair = idlist[i];
<a name="line131"></a>  document.write(i + &#39;) &#39; + pair.id + &#39; = &#39; + pair.name + &#39;&lt;br&gt;&#39;);
<a name="line132"></a>}
<a name="line133"></a>
<a name="line134"></a>document.write(&#39;&lt;hr&gt;&#39;);
<a name="line135"></a>*/
<a name="line136"></a>
<a name="line137"></a>// Test cases.
<a name="line138"></a>function testTimeZoneSelectedShortNames() {
<a name="line139"></a>  // Shortnames in German for France.
<a name="line140"></a>  var result = goog.locale.getTimeZoneSelectedShortNames(&#39;FR&#39;);
<a name="line141"></a>  assertEquals(&#39;Honolulu (Vereinigte Staaten)&#39;, result[3].name);
<a name="line142"></a>}
<a name="line143"></a>
<a name="line144"></a>function testTimeZoneSelectedLongNames() {
<a name="line145"></a>  // Long names in German for all English speaking regions.
<a name="line146"></a>  var result = goog.locale.getTimeZoneSelectedLongNames(&#39;en&#39;);
<a name="line147"></a>  assertEquals(&#39;GMT-11:00 Midway (Amerikanisch-Ozeanien)&#39;, result[1].name);
<a name="line148"></a>
<a name="line149"></a>  // Long names in German for germans.
<a name="line150"></a>  var result = goog.locale.getTimeZoneSelectedLongNames();
<a name="line151"></a>  assertEquals(&#39;GMT-10:00 Adak (Vereinigte Staaten)&#39;, result[2].name);
<a name="line152"></a>}
<a name="line153"></a>
<a name="line154"></a>function testTimeZoneAllLongNames() {
<a name="line155"></a>  // All longnames in German
<a name="line156"></a>  var result = goog.locale.getTimeZoneAllLongNames();
<a name="line157"></a>  assertEquals(&#39;GMT-10:00 Tokelau&#39;, result[7].name);
<a name="line158"></a>}
</pre>


</body>
</html>
